<?php include('header.php');?>
<h1 class="pagetitle"><?php include('menu.php');?></h1>
<div id="page">
<!-- start content -->
	<div id="content">		
		<form name="frmaddEditOrderDtls" method="POST" action="">
			<table cellspacing="5" cellpadding="5" width="50%" align="left" style="margin-left:-5px;margin-top:-5px;width:600px">
				<TR>
					<td class="headTDleft" colspan="7">
					<h2>Edit Sales Order</h2>
					</td>
				</TR>
				<?php if(count($errors) > 0){ ?>
				<tr>
					<td colspan="3" style="color:red">
						<ul>
							<?php 
								foreach($errors as $errorMsg){
									echo '<li>'.$errorMsg.'</li>';
								}
							?>
						</ul>
					</td>
				</tr>
				<?php } ?>
				<tr>
				<td width="100%" colspan="10" align="center">
				<table border=0 align="center" width="80%" style="border:1px solid gray" cellspacing="0" cellpadding="10">
				<tr>
					<td class="labeltext" align="left">Product Name</td>					
					<td align="left">
						<select id="lstProduct" name="lstProduct">
							<option value="0">Please Select Product</option>
							<?php
								if(count($productList) > 0){
									foreach($productList as $key=>$value){
										if($productId == $productList[$key]['ProductID']){
											$productSelection = 'selected';
										} else {
											$productSelection = '';
										}
							?>
							<option value="<?php echo $productList[$key]['ProductID'];?>" <?php echo $productSelection;?>><?php echo $productList[$key]['Name'];?></option>
							<?php
									}
								}
							?>
						</select>
					</td>
				</tr>
				<tr>
					<td class="labeltext" align="left">Quantity</td>
					<td align="left"><INPUT TYPE="text" NAME="txtProductQty" class="textBox" size="5" value="<?php echo $quantity;?>" maxlength="5"></td>
				</tr>
				<tr>
					<td colspan="1"></td>
					<td  align="left">
						<INPUT TYPE="SUBMIT" NAME= "btnSave" ID="btnSave" VALUE="Save" ONCLICK="" class="button">
						<INPUT TYPE="button" NAME= "btnCancel" ID="btnCancel" VALUE="Cancel" ONCLICK="window.location='?a=2'" class="button">
					</td>
				</tr>
				</table>
				</td>
				</tr>
			</table>
			<input type="hidden" name="salesorderid" value="<?php echo $salesOrderId;?>">
		</form>
	</div>
	<!-- end content -->
<?php include('auditLog.php');?>
<?php include('footer.php');?>